package com.onion.utils.file;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class FileTest {

    private static Set<String> uidSet = new HashSet<>();

    public static void main(String[] args){
        List<String> listData = new ArrayList<>();
        TxtReader.readByLines("D:/test/两性类用户uid.csv", listData);
        for(String line : listData){
            uidSet.add(line.trim());
        }

        listData.clear();
        int count = 0;
        TxtReader.readByLines("D:/test/情感类用户uid.csv", listData);
        for(String line : listData){
            if(!uidSet.contains(line.trim())){
                TxtWriter.append("D:/test/情感类用户uid-new.csv", "\r\n"+line.trim());
                uidSet.add(line.trim());
                count++;
            }
        }
        System.out.print(String.format("情感类用户uid: %d / %d", count, listData.size()));

        listData.clear();
        count = 0;
        TxtReader.readByLines("D:/test/生活类用户uid.csv", listData);
        for(String line : listData){
            if(!uidSet.contains(line.trim())){
                TxtWriter.append("D:/test/生活类用户uid-new.csv", "\r\n"+line.trim());
                uidSet.add(line.trim());
                count++;
            }
        }
        System.out.print(String.format("生活类用户uid: %d / %d", count, listData.size()));

        listData.clear();
        count = 0;
        TxtReader.readByLines("D:/test/健康类用户uid.csv", listData);
        for(String line : listData){
            if(!uidSet.contains(line.trim())){
                TxtWriter.append("D:/test/健康类用户uid-new.csv", "\r\n"+line.trim());
                uidSet.add(line.trim());
                count++;
            }
        }
        System.out.print(String.format("健康类用户uid: %d / %d", count, listData.size()));
    }

}
